package ch00;

import java.util.Random;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World!");

        int sum = 0;
        for (int i = 1; i <= 10; i++) {
            sum += i;
        }
        System.out.println("1-10的总和sum = "+sum);

        int[] array = {11,22,33,44,55,66,77,88};
        int evenSum = 0;
        for (int i: array) {
            if (i%2==0) {
                evenSum+=i;
            }
        }
        System.out.println("偶数总和evenSum = "+evenSum);

        int randNum = (int)(Math.random()*(100-1+1)+1);

//        Random random = new Random(System.currentTimeMillis());
//        int randNum = random.nextInt(100-1+1)+1;

//        Random random = new Random(System.currentTimeMillis());
//        int randNum = Math.abs(random.nextInt())%(100-1+1)+1;
        System.out.println("1-100之间的随机整数randNum = "+randNum);

        Student s1 = new Student(1,"李华",22,90.5);
        System.out.println(s1.toString());

        Student[] clazz = new Student[]{
          new Student(1,"李华",22,90.5),
          new Student(2,"吴明",23,70.5),
          new Student(3,"田浩",21,60),
          new Student(4,"张启明",22,84)
        };
        for (Student stu:clazz) {
            System.out.println(stu);
        }
    }
}
